package com.wufeng.springcloud.alibaba.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderController {
    @Resource
    private RestTemplate restTemplate;

    private static final String SERVICE_URL = "http://nacos-provider-service";

    @GetMapping("/consumer/payment/info/{id}")
    public String psymentInfo(@PathVariable("id") Long id){

        String result = restTemplate.getForObject(SERVICE_URL+ "/payment/info/" + id,String.class);
        log.info(result);
        return result;
    }

}
